/**
 * 
 */
package com.aco.party.common.servlet;

//import java.io.File;
//
//import javax.servlet.ServletContextEvent;  
//import javax.servlet.ServletContextListener;  
//import org.slf4j.Logger;  
//import org.slf4j.LoggerFactory;  
//
//import com.icss.background.common.util.SystemUtil;
//
//import ch.qos.logback.classic.LoggerContext;  
//import ch.qos.logback.classic.joran.JoranConfigurator;  
//import ch.qos.logback.core.joran.spi.JoranException;  
//
//
///** 
// * @version 1.0 
// */  
//public class LogbackConfigListener implements ServletContextListener {  
//    private static final Logger logger = LoggerFactory.getLogger(LogbackConfigListener.class);  
//     
//    private static final String CONFIG_LOCATION = "logbackConfigLocation";  
//    @Override  
//    public void contextInitialized(ServletContextEvent event) {  
//        //从web.xml中加载指定文件名的日志配置文件  
//        String logbackConfigLocation = event.getServletContext().getInitParameter(CONFIG_LOCATION);  
//        try {  
//        	String fn = this.getConfPath(logbackConfigLocation);
//            LoggerContext loggerContext = (LoggerContext)LoggerFactory.getILoggerFactory();  
//            loggerContext.reset();  
//            JoranConfigurator joranConfigurator = new JoranConfigurator();  
//            joranConfigurator.setContext(loggerContext);  
//            joranConfigurator.doConfigure(fn);  
//            logger.debug("loaded slf4j configure file from {}", fn);  
//            
//            
//        }  
//        catch (JoranException e) {  
//            logger.error("can loading slf4j configure file from " + logbackConfigLocation, e);  
//        }  
//    }  
//    
//    public String getConfPath(String param) {
//    	String configFilePath = SystemUtil.getAppConfigPathDir();
//		if (configFilePath == null) {
//			configFilePath = "." + File.separator;
//		}
//		if ((param == null) || (param.length() == 0)) {
//			logger.error("没有指定logback配置文件相对路径！");
//			return "";
//		}
//		configFilePath = configFilePath + File.separator + param;
//		System.out.println("###初始化配置文件根目录=" + configFilePath);
//    	return configFilePath;
//	}
//    
//    @Override  
//    public void contextDestroyed(ServletContextEvent event) {  
//    }  
//}  
